﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace NPMonitor.DataModel
{
    [Table("WorkflowJobs")]
    public class WorkflowJobData
    {
        [Key]
        public int Id { get; set; }

        [Required]
        public int WorkflowId { get; set; }

        public int Sequence { get; set; }

        [Required]
        public int JobId { get; set; }

        [Required]
        public string JobName { get; set; }

        [Required]
        public string FailureAction { get; set; }

        [NotMapped]
        public WorkflowJobFailureAction JobFailureAction
        {
            get { return Helpers.Utils.GetEnum<WorkflowJobFailureAction>(FailureAction, WorkflowJobFailureAction.Continue); }
            set { FailureAction = value.ToString(); }
        }
    }
}
